package com.study.zouchao.superproject.qustionadd.view;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;

import com.study.zouchao.superproject.R;


public class QuestionAddActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_question_add);
    }

    public static void actionStartQuestionAddActivity(Context context) {
        Intent intent = new Intent(context, QuestionAddActivity.class);
        context.startActivity(intent);
        ((Activity)context).overridePendingTransition(R.anim.anim_enter_activity, R.anim.anim_exit_activity);
    }

    public static void actionStartQuestionAddActivity(Context context, String tagId) {
        Intent intent = new Intent(context, QuestionAddActivity.class);
        intent.putExtra(QuestionAddFragment.KEY_TAG_ID, tagId);
        context.startActivity(intent);
        ((Activity)context).overridePendingTransition(R.anim.anim_enter_activity, R.anim.anim_exit_activity);
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            finish();
            overridePendingTransition(R.anim.anim_enter_activity, R.anim.anim_exit_activity);
            return true;
        } else {
            return super.onKeyDown(keyCode, event);
        }
    }

}
